package com.onlinevideo.entity;


import java.util.List;

public class Page<T> {

    public static final Integer DEFAULT_PAGE_SIZE = 5;
    public static final Integer DEFAULT_PAGE_NO = 1;
    //每页条数
    private Integer pageSize;
    //总页数
    private Integer pageCount;
    //总记录条数
    private Integer totalCount;
    //当前页数
    private Integer pageNo;
    //数据
    private List<T> data;

    private Integer begin;

    public Integer getBegin() {
        return begin;
    }

    public void setBegin(Integer begin) {
        this.begin = begin;
    }

    public Page(Integer pageSize, Integer pageNo) {
        if (pageSize != null) {
            this.pageSize = pageSize;
        }else {
            this.pageSize = DEFAULT_PAGE_SIZE;
        }
        if (pageNo != null) {
            this.pageNo = pageNo;
        }else {
            this.pageNo = DEFAULT_PAGE_NO;
        }
        begin = (this.pageNo - 1) * this.pageSize;

    }

    public void setTotalCount(Integer totalCount) {
        this.totalCount = totalCount;
    }


    public void setData(List<T> data) {
        this.data = data;
    }


    public static Integer getDefaultPageSize() {
        return DEFAULT_PAGE_SIZE;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public Integer getPageCount() {
        return pageCount;
    }

    public void setPageCount(Integer pageCount) {
        this.pageCount = pageCount;
    }

    public Integer getTotalCount() {
        return totalCount;
    }

    public Integer getPageNo() {
        return pageNo;
    }

    public List<T> getData() {
        return data;
    }
}
